package log;

/**
 * Implements the logging system of chat between two users. 
 * @author Alexandre, Cristovao, Raul, Rodolpho, Tales
 * @version 1.1
 * @milestone Number 2
 */
public class ChatLog implements Registrable{
	
	String logFileName = "";

	/**
	 * Constructor of the class. Start the logging chat between two users.
	 * @param user1 a user
	 * @param user2 another user
	 */
	public ChatLog(String user1, String user2){
		if (user1.compareTo(user2) > 0) {
			this.logFileName = user2 + "-" + user1;
		} else {
			this.logFileName = user1 + "-" + user2;
		}
	}
	
	/**
	 * Get the error message if any problem occur when log the chat. 
	 */
	public String getErrorMessage() {
		return "Erro ao criar log do chat entre: " + getService() + ".";
	}

	/**
	 * Get the filename of the chat between user1 and user2.
	 * @return the log filename
	 */
	public String getService() {
		return this.logFileName;
	}

	/**
	 * Get the success message if no problems occur when log the chat. 
	 * @return 
	 */
	public String getSuccessMessage() {
		return "Log do chat entre: " + getService() + " criado com sucesso.";
	}

}
